package com.muyu.user.domain.resp;

import java.math.BigDecimal;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import com.muyu.user.domain.SysConsumptionRecord;
import com.muyu.user.domain.model.SysConsumptionRecordPageQueryModel;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.AllArgsConstructor;
import lombok.experimental.SuperBuilder;

/**
 * 消费记录分页接口返回结果集
 *
 * @author liuguoqiang
 * @date 2025-09-18
 */
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@Schema(description = "消费记录分页接口返回结果集")
public class SysConsumptionRecordPageResp {

    /**
     * 订单ID
     */
    @Schema(name = "orderId", title = "订单ID", description = "订单ID" )
    private Long orderId;

    /**
     * 收货人
     */
    @Schema(name = "consignee", title = "收货人", description = "收货人" )
    private String consignee;

    /**
     * 商品数量
     */
    @Schema(name = "productCount", title = "商品数量", description = "商品数量" )
    private Long productCount;

    /**
     * 商品总价
     */
    @Schema(name = "totalPrice", title = "商品总价", description = "商品总价" )
    private BigDecimal totalPrice;

    /**
     * 实付金额
     */
    @Schema(name = "actualAmount", title = "实付金额", description = "实付金额" )
    private BigDecimal actualAmount;

    /**
     * 交易完成时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Schema(name = "createTime", title = "交易完成时间", description = "交易完成时间" )
    private Date createTime;

    /**
     * 信息构造器
     */
    public static SysConsumptionRecordPageResp infoBuild(SysConsumptionRecordPageQueryModel pageQueryModel){
        return SysConsumptionRecordPageResp.builder()
            .orderId(pageQueryModel.getOrderId())
            .consignee(pageQueryModel.getConsignee())
            .productCount(pageQueryModel.getProductCount())
            .totalPrice(pageQueryModel.getTotalPrice())
            .actualAmount(pageQueryModel.getActualAmount())
            .createTime(pageQueryModel.getCreateTime())
            .build();
    }

}
